<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
    version="1.0"
    xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" 
    xmlns:xf="http://www.w3.org/2002/xforms" 
    xmlns:ev="http://www.w3.org/2001/xml-events" 
    xmlns:xhtml="http://www.w3.org/1999/xhtml"
    xmlns="http://www.w3.org/1999/xhtml" 
    xmlns:atom="http://www.w3.org/2005/Atom"
    xmlns:app="http://purl.org/atom/app#" 
    xmlns:ui="urn:uuid:user-interface-patterns#">
    <xsl:template match="/">
        <!-- TODO: Need a GRDDL transformation algorithm (or native RDFa) to express the Feed via AtomOWL / RDF Forms? -->
        <html xmlns:xf="http://www.w3.org/2002/xforms" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://www.w3.org/1999/xhtml" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:ev="http://www.w3.org/2001/xml-events">    
            <head profile="http://www.w3.org/2003/g/data-view">
                <link rel="transformation" href="http://www-sop.inria.fr/acacia/soft/RDFa2RDFXML.xsl" />        
                <title>Atom Collection (Feed)</title>
                <link href="atom.css" rel="stylesheet"/>       
            </head>
            <body>
                <h1>Collection (Feed) - <xsl:value-of select="atom:feed/atom:title"/></h1>
                <ul>
                    <xsl:for-each select="atom:entry">
                        <li>
                            <a href="/atom-edit/?uri={@href}&amp;type=entry">
                                <xsl:value-of select="atom:title"/><xsl:apply-templates select="atom:author"/></a>
                        </li>
                    </xsl:for-each>                        
                </ul>                 
            </body>
        </html>
    </xsl:template>
    <xsl:template match="atom:author">
        <xsl:if test="position() = 1">(</xsl:if>
        <xsl:value-of select="atom:name"/><xsl:if test="position() > 1 and position() != last()">,</xsl:if>
        <xsl:if test="position() = last()">(</xsl:if>
    </xsl:template>
    <xsl:template match="app:collection">
        <li><a href="@href"><xsl:value-of select="atom:title"/></a></li>
    </xsl:template>
    <xsl:template match="app:service/app:workspace">
        <fieldset>
            <legend><xsl:value-of select="atom:title"/></legend>
            <xsl:if test="app:collection">
                <ul>
                    <xsl:apply-templates select="app:collection"/>
                </ul>
            </xsl:if>            
        </fieldset>   
    </xsl:template>
    <xsl:template match="@*|node()">
        <xsl:copy>
            <xsl:apply-templates select="@*|node()"/>
        </xsl:copy>
    </xsl:template>
</xsl:stylesheet>